﻿using MaterialSkin.Controls;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace Model_management
{
    public partial class wirtePLCFrom : MaterialForm
    {
        Model_Management this_buf;
        string[] mame = new string[3];

        public wirtePLCFrom(Model_Management _this)
        {
            SetStyle(ControlStyles.UserPaint | ControlStyles.ResizeRedraw | ControlStyles.AllPaintingInWmPaint | ControlStyles.OptimizedDoubleBuffer, true);
            UpdateStyles();
            InitializeComponent();
            this_buf = _this;


            try
            {
                mame[0] = this_buf.label2.Text.Substring(this_buf.label2.Text.IndexOf("：") + 1, this_buf.label2.Text.Length - this_buf.label2.Text.IndexOf("：") - 1);
                mame[1] = this_buf.label3.Text.Substring(this_buf.label3.Text.IndexOf("：") + 1, this_buf.label3.Text.Length - this_buf.label3.Text.IndexOf("：") - 1);
                mame[2] = this_buf.label4.Text.Substring(this_buf.label4.Text.IndexOf("：") + 1, this_buf.label4.Text.Length - this_buf.label4.Text.IndexOf("：") - 1);

                ;
            }
            catch {; }

            label1.Text = "机型型号：" + mame[0];//机型型号
            label2.Text = "配方组ID：" + mame[1];//配方组ID
            label3.Text = "配方ID：" + mame[2];//配方ID

        }

        private void wirtePLCFrom_Load(object sender, EventArgs e)
        {

        }

        private void button2_Click(object sender, EventArgs e)
        {
            this_buf.station_state[0] = station_1.Checked;
            this_buf.station_state[1] = station_2.Checked;
            this_buf.station_state[2] = station_3.Checked;
            this_buf.station_state[3] = station_4.Checked;
            this_buf.station_state[4] = station_5.Checked;
            this_buf.station_state[5] = station_6.Checked;
            this_buf.station_state[6] = station_7.Checked;
            this_buf.station_state[7] = station_8.Checked;

            this_buf.Model_Click(mame);
        }

        private void button1_Click(object sender, EventArgs e)
        {
            this.Dispose();
            GC.Collect();
            GC.WaitForPendingFinalizers();
        }

        private void wirtePLCFrom_FormClosed(object sender, FormClosedEventArgs e)
        {
            this.Dispose();
            GC.Collect();
            GC.WaitForPendingFinalizers();
        }
    }
}
